import { RequestHandler } from 'express'
import { failure, success } from '@/utils/response'
import categoryService from '@/services/categoryService'

const getCategories: RequestHandler = async function (req, res) {
  try {
    const data = await categoryService.getCategories()
    success(res, '查询分类列表成功。', data)
  } catch (error) {
    failure(res, error as Error, '查询分类列表失败：')
  }
}

export default {
  getCategories,
}
